import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity({
  name: 'users',
})
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    length: 50,
    comment: '账户',
  })
  account: string;

  @Column({
    length: 50,
    comment: '用户名',
    unique: true,
  })
  username: string;

  @Column({
    length: 50,
    comment: '昵称',
    nullable: true,
  })
  nickName: string;

  @Column({
    length: 50,
    comment: '密码',
  })
  password: string;

  @Column({
    comment: '性别 0 女 1男',
    length: 50,
    default: '1',
  })
  gender: string;

  @Column({
    comment: '头像',
    length: 1024,
    nullable: true,
  })
  avatarURL: string;
  @Column({
    comment: '邮箱',
    length: 50,
    nullable: true,
  })
  email: string;
  @Column({
    comment: '手机号',
    length: 20,
    nullable: true,
  })
  phone: string;

  @Column({
    comment: '是否是管理员 0 普通账号 1管理员',
    length: 20,
    default: '0',
  })
  isAdmin: string;

  @Column({
    comment: '账号状态 0 禁用 1正常',
    length: 20,
    default: '1',
  })
  status: string;

  @Column({
    comment: '权限',
    length: 1024,
    nullable: true,
  })
  role: string;

  @CreateDateColumn({
    comment: '创建时间',
  })
  createTime: Date;

  @UpdateDateColumn({
    comment: '更新时间',
  })
  updateTime: Date;

  @Column({
    comment: '是否删除 0 删除 1正常',
    length: 20,
    default: '1',
  })
  isDetele: string;
}
